using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace Splino
{
    /// <summary>
    /// A derivation of the ToolStrip component that allows clicks
    /// even if the form containing it does not have focus
    /// </summary>
    public partial class SplinoToolStrip : ToolStrip
    {
        /// <summary>
        /// Constructor
        /// </summary>
        public SplinoToolStrip()
        {
            InitializeComponent();
        }

        /// <summary>
        /// Passes click events to the ToolStrip even if the form
        /// containing it does not have focus
        /// </summary>
        /// <param name="m"></param>
        protected override void WndProc(ref Message m)
        {
            if (m.Msg == 0x0021 && this.CanFocus && !this.Focused)
                this.Focus();
            base.WndProc(ref m);
        }
    }
}
